package com.haven123.cloudapp.rabbitmq.Config;

import org.springframework.amqp.core.Exchange;
import org.springframework.amqp.core.ExchangeBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class ExchangeConfig {
    public static final String direct_name="direct_exhange";
    public static final String fanout_name="fanout_exhange";
    public static final String topic_name="topic_exhange";
    public static final String direct_name_dlx="direct_exhange_dlx";//死信交换器

    @Bean
    public Exchange directExhange(){
       return  ExchangeBuilder.directExchange(direct_name)
                .durable(false)
                .build();
    }
    @Bean
    public Exchange directExhangedlx(){
       return  ExchangeBuilder.directExchange(direct_name_dlx)
                .durable(false)
                .build();
    }
    @Bean
    public Exchange fanoutExhange(){
       return  ExchangeBuilder.fanoutExchange(fanout_name)
                .durable(false)
                .build();
    }
    @Bean
    public Exchange topicExhange(){
       return  ExchangeBuilder.topicExchange(topic_name)
                .durable(false)
                .build();
    }
}
